<?php
namespace app\manage\model;

class Bag extends Base
{
    protected $insert = ['add_time'];

    //添加时间
    public function getAddTimeAttr($value){
        return date('Y-m-d H:i:s', $value);
    }
    protected function setAddTimeAttr(){
        return time();
    }

    //过期时间
    public function getExpireTimeAttr($value){
        return date('Y-m-d H:i:s', $value);
    }
    public function setExpireTimeAttr($value){
        return strtotime($value);
    }

    //使用方法
    public function getSummaryAttr($value){
        return str_replace("##", "\n", $value);
    }
    public function setSummaryAttr($value){
        return str_replace("\n", "##", $value);
    }

    //礼包内容
    public function getContentAttr($value){
        return str_replace("##", "\n", $value);
    }
    public function setContentAttr($value){
        return str_replace("\n", "##", $value);
    }

    //游戏名称
    public function getGameNameAttr($value, $data){
        $gameIdName = changeValKey('ViewGameManage', 'game_id', 'game_name');
        return $gameIdName[$data['game_id']];
    }
}